import json
import re

tiers = ['金', '银', '铜']
elements = ['火', '水', '木', '土', '光', '暗']
tags = ['善良', '猫咪', '武器', '温柔', '彩蛋', '妹子', '黑暗', '珍奇', '奇特', '财迷', '飞翔', '呆萌', '奥运', '冰冷', '机械', '生肖', '神秘', '法器', '水性', '娇小', '律法',
        '五周年', '神速', '魁梧', '乐器', '神仙', '神勇', '旅人', '正义', '人形', '妖怪', '美食', '吉祥', '狗狗', '神器', '扑克', '谋略', '自然', '龙族', '老人家', '战士', '小眼睛']

data = None
with open('data/data.json', 'r', encoding='utf-8') as f:
    data = json.load(f)

monsters = data['monsters']
for s in monsters:
    print(s)
    ss = s.split('|')
    assert(len(ss) == 14)
    assert(ss[0].isnumeric())
    assert(ss[1])
    assert(ss[2] in tiers)
    assert(ss[3] in elements)
    assert(0 <= int(ss[4]) <= 5)
    for tag in ss[5].split(','):
        assert(tag in tags)
    for i in range(6, 12):
        assert(re.match('-?\d+', ss[i]))
    assert(not ss[12].isnumeric())
